home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 005 / fm32.arc / FM32.TXT < prev   
Text File  |  1987-06-02  |  13KB  |  348 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.             
  8.  
  9.  
  10.  
  11.  
  12.                                    FM User's Guide
  13.  
  14.                               Version 3.2, June 2, 1987
  15.                          Copyright (c) 1987 by Thomas Stepka
  16.                                  7702 Lunceford Lane
  17.                                Falls Church, Va 22043
  18.                                  All rights reserved
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.           1. Intended Audience
  27.  
  28.           FM stands for FAT Manager, and FAT in turn stands for File
  29.           Allocation Table.  The FAT is a data structure put on every disk
  30.           by DOS during formatting, and it keeps track of which sectors of
  31.           the disk are allocated to each file in the directory.  If you
  32.           don't already know what a FAT or a cluster or a logical sector or
  33.           a cluster chain is, then you don't need this program.
  34.  
  35.  
  36.  
  37.  
  38.           2. Functions and Features
  39.  
  40.                FM was written to plug a functionality hole in existing
  41.           utility software.  I have often noticed DOS doing several retries
  42.           when trying to read a disk file, or even returning an I/O error;
  43.           but whenever I ran FORMAT or the Norton Utility DISKTEST, all
  44.           clusters would check out OK.  I wanted a way to arbitrarily mark
  45.           areas of the disk off limits to I/O, and to restore those areas
  46.           at any future time if I so wished.  FM is the result.
  47.  
  48.           Following are the basic functions and features of FM:
  49.  
  50.                a. List all clusters on the target disk by type (bad,
  51.                occupied or unused), with corresponding logical sector
  52.                numbers.  
  53.  
  54.                b. Display the status of a cluster or sector, including
  55.                which file or subdirectory (if any) occupies it.
  56.  
  57.                c. Enter numbers and display results in either decimal, hex,
  58.                or octal.
  59.  
  60.                d. Make unused clusters bad or reserved, so DOS will not use
  61.                them.
  62.  
  63.                e. Make bad or reserved clusters good, available for use
  64.                again.
  65.  
  66.                f. List all changes made to the FAT during a session.
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.           2. FM Design Philosophy
  74.  
  75.                Since the FAT is such a crucial data structure, FM takes 
  76.           precautions to ensure the file structure on the target disk is
  77.           not corrupted.  Specifically:
  78.  
  79.                The B, G and R commands to change the status of a cluster
  80.           always give unambiguous feedback showing the results of the
  81.           command.  
  82.  
  83.                FM will not allow you to change the status of a cluster that
  84.           is occupied by file or subdirectory.
  85.  
  86.                The C command shows a history of all changes since running
  87.           FM, so you can't forget what you have done.
  88.  
  89.                FM copies the FAT of the target disk into memory and works
  90.           with the memory copy.  It writes the FAT back to disk only when
  91.           you quit, and only if you give final approval.  You can also
  92.           abort FM with control-c without changing the disk FAT.
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.           3. One Word Of Caution
  100.  
  101.                FM is not an every day utility - it is more a last resort. 
  102.           FM performs a function normally thought to be left to DOS only. 
  103.           Certainly, DOS assumes no applications program would ever change
  104.           the FAT in any way.  Therefore, FM must be used realizing this,
  105.           and with a certain amount of caution as discussed below.
  106.  
  107.                Do not run FM while on a network or in any situation where a
  108.           new file could be created on disk while FM is running.  Either
  109.           remove or make sure you don't use any memory resident utilities
  110.           which can create a new file on the target disk (eg the Sidekick
  111.           Notepad).
  112.  
  113.                FM reads the FAT only once at startup, and then works with a
  114.           memory copy of it.  Thus, it cannot detect a new file created on
  115.           the target disk while it is running.  So, if you tell FM to write
  116.           a new FAT at the end of a session, any new file will still be in
  117.           its directory, but its allocated clusters will be overwritten. 
  118.           You will then find it difficult or impossible to read or copy
  119.           this file.  This will only affect your new file, however, and
  120.           running CHKDSK/F will make things right again.
  121.  
  122.                FM has one insecurity, because the C, F, and L commands
  123.           allow you to redirect their output to a disk file.  If you
  124.           redirect output to the target disk you be in the situation
  125.           described above.  Again, CHKDSK/F will fix the problem.
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.                Finally, if you change the FAT and write a new one to a hard
  133.           disk, reboot DOS after exiting FM.  This is because DOS keeps
  134.           part of the FAT in its own memory, and doesn't know the FAT has
  135.           been changed.  Therefore, if you don't reboot DOS may allocate
  136.           disk space based on its outdated information about the FAT.
  137.  
  138.  
  139.  
  140.  
  141.           4. Running FM
  142.  
  143.                FM runs on IBM-PC's AT's and clones using MS-DOS v 2.0 and
  144.           later.  To run, FM requires anywhere from 66K of RAM (for a 360K
  145.           floppy) up to 160K (for a 30MB hard disk).  Up to 2000 files may
  146.           exist on the disk, and as many as 100 subdirectories.  FM may not
  147.           work on some disks formatted by DOS v 1.x.
  148.  
  149.                Run CHKDSK/F on the target disk to remove orphaned clusters. 
  150.           This is recommended but not necessary.
  151.  
  152.                At the DOS prompt, type FM [d].  [d] is an optional drive
  153.           specifier; if you don't specify the drive, FM will type brief
  154.           operating instructions.
  155.  
  156.                Once started, FM will read the boot sector to get basic
  157.           information about the structure of the disk.  Disks formatted by
  158.           DOS v 1 have a different boot sector format from those formatted
  159.           by DOS v 2 and later; FM will not work with v1 disks.
  160.  
  161.                FM then reads all copies of the FAT (typically there are
  162.           two).  FM will compare all copies with each other, checking for
  163.           differences; if the copies are different FM will inform you and
  164.           ask your permission to assume the first FAT copy is the good one. 
  165.           If you have been using the disk with no problems, just say yes,
  166.           and FM will then overwrite the bad copy with the good one at quit
  167.           (see Q command below) time.
  168.  
  169.                Finally, FM reads the entire directory structure on the disk
  170.           and notes the name of the file occupying each cluster of the
  171.           disk.
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.           5.  FM Commands
  179.  
  180.           Once up and running FM accepts the following commands.
  181.  
  182.  
  183.  
  184.  
  185.           SPECIFYING CLUSTERS AND SECTORS
  186.  
  187.           When you want to examine or change a cluster, FM gives you the
  188.           option of specifying either the cluster, or any of the logical
  189.           sectors that make up the cluster.  To specify a cluster type 'C'
  190.           followed by the cluster number,  no intervening spaces. To
  191.           specify a logical sector type 'S' followed by the sector number;
  192.           FM then operates on the entire cluster of which that sector is a
  193.           part.  You may use the N command, described below, to specify the
  194.           number base of your input.  If you make a mistake FM comes back
  195.           with some help.  If you find you want to abort a B, E, G or R
  196.           command, just hit the return (enter) key.
  197.  
  198.  
  199.  
  200.           CTRL-C
  201.  
  202.           Type ctrl-c at the command prompt to abort FM and return to DOS
  203.           with the FAT unchanged.
  204.  
  205.  
  206.  
  207.  
  208.           THE ? COMMAND
  209.  
  210.           Lists a command summary, the current number base, and shows the
  211.           legal range of values for cluster and sector numbers.
  212.  
  213.  
  214.  
  215.  
  216.           THE B COMMAND 
  217.  
  218.           Marks the specified cluster bad, preventing DOS from writing to
  219.           it.  You enter the cluster or sector number in the current number
  220.           base, controlled by the N command.  This command only works on
  221.           clusters that are not currently occupied by a file.
  222.  
  223.  
  224.  
  225.  
  226.           THE C COMMAND
  227.  
  228.           Lists a summary of all net changes made to the FAT since FM was
  229.           started.  Changes include marking sectors bad, good, or reserved.
  230.           Only net changes are reported.  You have the option of
  231.           redirecting output to PRN or a disk file.  Please read the
  232.  
  233.  
  234.  
  235.  
  236.  
  237.           caution in section 3. against sending a disk file to the target
  238.           disk.
  239.  
  240.  
  241.  
  242.  
  243.           THE D COMMAND
  244.  
  245.           Lists the basic sizing parameters of the target disk, such as
  246.           sector size, cluster size, FAT size, and root directory size. 
  247.           These are gathered by reading the boot sector of the target disk.
  248.  
  249.  
  250.  
  251.           THE E COMMAND
  252.  
  253.           Examines a cluster to determine its status.  Status is either
  254.           unused, bad, reserved, or in use by a file.  If in use, the file
  255.           occupying that cluster is shown.  If in use or reserved, the
  256.           value of the FAT entry (ie the pointer to the next cluster) is
  257.           shown in the selected number base.
  258.  
  259.  
  260.  
  261.           THE F COMMAND
  262.  
  263.           Lists all subdirectories and files on the target disk.  This is
  264.           primarily a programmer's debugging feature, but it has been left
  265.           in the public version of FM.  You have the option of redirecting
  266.           output to another device or file, but please read the caution in
  267.           section 3 against writing a file to the target disk.
  268.  
  269.  
  270.  
  271.  
  272.           THE G COMMAND
  273.  
  274.           Marks a bad or reserved sector as unused, available for use.  You
  275.           enter the cluster or sector number in the current number base,
  276.           controlled by the N command.  This command only works on clusters
  277.           that are currently bad or reserved.
  278.  
  279.  
  280.  
  281.           THE L COMMAND
  282.  
  283.           Produces a list of all bad and reserved clusters on the target
  284.           disk.  FM first asks you which type of cluster you want to list -
  285.           bad, unused, reserved or occupied.  FM then asks you for an
  286.           output device or file, you enter something like PRN for a
  287.           printout or a:fm.log for a disk copy.  See the caution in section
  288.           3. against sending the output to the target disk.  THe number
  289.           base of the cluster numbers is controlled by the N command.
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.           THE N COMMAND
  300.  
  301.           Controls the number base for numerical input and output.  FM
  302.           starts assuming decimal, and successive N commands cycle the
  303.           number base from decimal to hex to octal, back to decimal.
  304.  
  305.  
  306.  
  307.           THE Q COMMAND
  308.  
  309.           Quits FM.  Before returning to DOS, FM asks you if you want to
  310.           write the FAT out to the target disk.  This is the one and only
  311.           time FM will write a changed FAT back to the target disk.  If you
  312.           answer N the target disk is left in its original state.
  313.  
  314.  
  315.  
  316.           THE R COMMAND
  317.  
  318.           Marks a cluster as reserved.  You enter the cluster or sector
  319.           number in the current number base, controlled by the N command. 
  320.           This command does not work on clusters currently occupied by a
  321.           file.  NOTE: The concept of reserved cluster appears in several
  322.           DOS technical references, but apparently reserved clusters have
  323.           no meaning to any available version of DOS (v 3.2 and before). 
  324.           It is included in FM for the sake of completeness.  Marking a
  325.           cluster reserved will cause CHKDSK to report an "orphan cluster";
  326.           CHKDSK/F will then recover that cluster into one of its .CHK
  327.           files.
  328.  
  329.  
  330.  
  331.  
  332.  
  333.           5. Other Notes
  334.  
  335.           FM was written in C and compiled on the Microsoft C compiler, v
  336.           4.00.
  337.  
  338.           Source code is available upon request.
  339.  
  340.           Comments, suggestions and bug reports are welcome.  I can be
  341.           reached at the above address, or on the ASTRO BBS, (202) 547-
  342.           4418.
  343.  
  344.           All rights reserved.  This program may be freely copied and
  345.           distributed, for personal use only, charging only for media and
  346.           duplication costs.  This program may not be sold for profit or
  347.           distributed in modified form.
  348.